I'd like to show you that applets can be controlled from JavaScript. This timezone clock applet has a settimezone(String offset_in_minutes) method which can be used in JavaScript, as in the example I created an HTML form to choose a timezone, and wrote a simple script which evoked the applet settimezone method, when you chose the timezone. By the way, if you decide to host this applet on one of your pages, you can choose any size for the clock you want, changing WIDTH and HEIGHT statements of applet tag.
|
tzclock.class Java applet ----> |
|
|
HTML form and JavaScript functions ----> |
|
|
Choose timezone in HTML choice form, and see how it interacts with the applet. |
|
| Name: | Value: |
| AUTHOR | "Virtual_Max (http://come.to/vmax)" obligatory parameter for free applet.. |
| BGIMAGE | Optional parameter for page background image. only JPG and GIF formats supported. This and other colors should be in hexadecimal format without any format symbols i.e. for red color value it should be "FF0000" |
| BGCOLOR | OR Optional parameter for Applet solid color background if the BGIMAGE parameter is not specified. |
| COLOR | Main drawing color |
| DCOLOR | Optional Dark color for shadows, if that parameter isn't specified, no shadows will be drawn |
| LCOLOR | Optional Light color for shining parts, if not specified no shining parts will be drawn |
settimezone(String timezoneoffset_in_minutes)
This is the method for setting the time zone offset (in minutes). For example, for EST (GMT -5:00) this value should be "-300" Can
be called from JavaScript
String getlocaltimezone() this applet method returns the local timezone, in minutes. Assuming that DLST lasts from the last Sunday of march to the last Sunday of September in most of countries, this method obtains the local time zone offset from the computer's system and calculates the timezone. I'll try to illustrate this. Java and Javascript methods getTimezoneOffset() return offset including DLST, for EST -5:00. This method returns -4:00 in summer and -5:00 in winter, meanwhile getlocaltimezone() method always returns -5:00 for EST timezone.
setclocktitle(String title) method allows you to change the title on the clock face dynamically.
<APPLET NAME=clock CODE=tzclock.class WIDTH=200 HEIGHT=200> <PARAM NAME="AUTHOR" VALUE="Virtual_Max (http://come.to/vmax)"> <PARAM NAME="BGIMAGE" VALUE="gold1.gif"> <PARAM NAME="BGCOLOR" VALUE="000000"> <PARAM NAME="COLOR" VALUE="A0A000" > <PARAM NAME="DCOLOR" VALUE="606000"> <PARAM NAME="LCOLOR" VALUE="C0C000"> </APPLET>
Assuming you used name=clock as in the above tag, you can call applet the methods as following
<SCRIPT>
function SetMoscowTime()
{ document.clock.setclocktitle("Moscow Time");
document.clock.settimezone("+240");
}
</SCRIPT>